import request from "@/utils/request";

const api = {
  getMaterialCategorys: "/cms/category/group/list",
  createMaterialCategory: "/cms/category/group/create",
  deleteMaterialCategory: "/cms/category/group/delete"
};

export function getMaterialCategorys(type) {
  /**
    POSTER: 获客海报
    ARTICLE: 获客文章
    VIDEO:  获客视频
    FILE:  获客文件
    HYPERLINK: 网页链接
    MINI_PROGRAM: 小程序链接
    */
  return request({
    url: api.getMaterialCategorys,
    params: {
      materialType: type
    }
  });
}

export function createMaterialCategory(parameter) {
  return request({
    url: api.createMaterialCategory,
    method: "put",
    data: parameter
  });
}

export function deleteMaterialCategory({ id }) {
  return request({
    url: `${api.deleteMaterialCategory}/${id}`,
    method: "delete"
  });
}
